<?php
@session_start();

$u_name= $_SESSION['u_name'];
$u_email= $_SESSION['u_email'];
$u_id= $_SESSION['u_id'];
$group= $_SESSION['group'];
$for= $_SESSION['uid'];
mysql_connect("localhost","root","");
mysql_select_db("chat")or die(mysql_error());
$msg= $_POST['msg'];

if(!isset($_SESSION['uid'])){
	mysql_query("INSERT INTO chat_msg(msg, sender_u_id, for_group_id)VALUES('$msg', '$u_id', '$group')")or die(mysql_error());
	header('location:chatwindow.php'); }else{
	mysql_query("INSERT INTO chat_msg(msg, sender_u_id, for_u_id)VALUES('$msg', '$u_id', '$for')")or die(mysql_error());
	exit;
		
	}

?>